import Vue from 'vue'
import axios from 'axios'
axios.defaults.withCredentials = true
//新建任务
export function submitGrid (formData) {
  return new Promise((resolve, reject)=> {
    axios.post(Vue.prototype.HTTP + '/task/add', formData).then(res=> {
      resolve(res.data);
    }).catch(res=>{
      reject(res.data)
    })
  })
}
//获取和查询任务列表
export function getGridList (page, pageNum, data) {
  return new Promise((resolve,reject)=> {
    let pages = page ? page : 1;
    pageNum = pageNum ? pageNum : 10;
    let content = {
      pages: pages,
      pageNum: pageNum,
      data: data
    }
    axios.post(`${Vue.prototype.HTTP}/task/list`, content).then((res) => {
      resolve(res.data);
    }).catch((res) => {
      reject(res.data);
    })
  })
}
export function exportExcel(data) {
  return new Promise((resolve,reject)=> {
    axios.post(Vue.prototype.HTTP + '/grid/exportExcel', data).then(res=> {
      resolve(res.data);
    }).catch(res=>{
      reject(res.data)
    })
  })
} 
export function addpeople(data) {
  return new Promise((resolve,reject)=> {
    axios.post(Vue.prototype.HTTP + '/manpower/peopleadd', data).then(res=> {
      resolve(res.data);
    }).catch(res=>{
      reject(res.data)
    })
  })
} 
// 人力查询
export function searchManpower(data) {
  return new Promise((resolve,reject)=> {
    axios.post(Vue.prototype.HTTP + '/manpower/search', data).then(res=> {
      resolve(res.data);
    }).catch(res=>{
      reject(res.data)
    })
  })
} 

